package com.sirap.spring.boot.demo.sword;

import com.sirap.basic.component.Konstants;
import com.sirap.basic.domain.MexItem;
import com.sirap.basic.domain.ValuesItem;
import com.sirap.basic.util.EmptyUtil;
import com.sirap.basic.util.StrUtil;

public class CarTravelItem extends MexItem implements Comparable<CarTravelItem> {

	private static final long serialVersionUID = 1L;
	
	private String ownerName;	//A
	private String ownerType;	//B
	private String carplate;	//C
	private String deviceno;	//D
	private String dateinfo;	//E
	private String cartype;	//E
	private int ktimes;

	public String getOwnerName() {
		return ownerName;
	}

	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

	public String getOwnerType() {
		return ownerType;
	}

	public void setOwnerType(String ownerType) {
		this.ownerType = ownerType;
	}

	public String getCarplate() {
		return carplate;
	}

	public void setCarplate(String carplate) {
		this.carplate = carplate;
	}

	public String getDeviceno() {
		return deviceno;
	}

	public void setDeviceno(String deviceno) {
		this.deviceno = deviceno;
	}
	
	public String getDateinfo() {
		return dateinfo;
	}

	public void setDateinfo(String dateinfo) {
		this.dateinfo = dateinfo;
	}

	public String getCartype() {
		return cartype;
	}

	public void setCartype(String cartype) {
		this.cartype = cartype;
	}
	
	public int getKtimes() {
		return ktimes;
	}

	public void setKtimes(int ktimes) {
		this.ktimes = ktimes;
	}

	public String goodOwnerName() {
		if(StrUtil.equals(ownerName, Konstants.SHITED_FACE) || EmptyUtil.isNullOrEmpty(ownerName)) {
			return "未知单位";
		}
		
		return ownerName;
	}

	public String goodOwnerType() {
		if(StrUtil.equals(ownerType, Konstants.SHITED_FACE) || EmptyUtil.isNullOrEmpty(ownerType)) {
			return "未知性质";
		}
		
		return ownerType;
	}

	public String goodCarType() {
		if(StrUtil.equals(cartype, Konstants.SHITED_FACE) || EmptyUtil.isNullOrEmpty(cartype)) {
			return "未知车型";
		}
		
		return cartype;
	}

	@Override
	public String toString() {
		ValuesItem vi = new ValuesItem();
		vi.add(goodOwnerName());
		vi.add(goodOwnerType());
		vi.add(carplate);
		vi.add(ktimes);
		vi.add(deviceno);
		vi.add(dateinfo);
		vi.add(goodCarType());
		
		return vi.toPrint();
	}

	@Override
	public int compareTo(CarTravelItem other) {
		return carplate.compareTo(other.getCarplate());
	}
	
}
